/** Class Name: OORTelesalesGetFirstLeadTest
 * Author: Accenture
 * Date: 3-March-2012
 * Requirement/Project Name: OOR Telesales
 * Requirement Description:  Test class for OORTelesalesGetFirstLead
 **/
 
@istest(seealldata=true)
private class OORTelesalesGetFirstLeadTest
{   
        
    /**
     *  Test method 
     */  
    static testMethod void testGetFirstLead() 
    {
      ID localAdvertiserRecordTypeID = RecordTypeHelper.GetRecordTypeIdByDevName('Lead', OORTelesalesTextConstant.LOCAL_ADVERTISER_LEAD_REC_TYPE);   
      List<Sobject> campList  = new List<Sobject>();
      Lead  le  = new Lead(FirstName='testFirstName',LastName = 'ash', company='ABc',Lead_Status_ReadOnly__c = 'New' ,Status='New',RecordTypeId= localAdvertiserRecordTypeID );
      insert le;
      
      Campaign camp = new Campaign(Name='abx',IsActive=True,StartDate=Date.Today());
      insert camp;
      
      CampaignMember  campMemb  = new CampaignMember();
      campMemb.CampaignId =camp.id;
      campMemb.LeadID =le.id;
      insert campMemb  ;
       
      ApexPages.StandardController StdCtrl = new ApexPages.StandardController(camp );
      OORTelesalesGetFirstLead OORtelFirstlead = new OORTelesalesGetFirstLead(StdCtrl);
      OORtelFirstlead.getFirstLeadFromDetail();
      campList.add(camp);
      
      ApexPages.StandardSetController StdCtrl1 = new ApexPages.StandardSetController (Database.getQueryLocator([Select id from Campaign  where id = :camp.id ] ));
      OORTelesalesGetFirstLead OORtelFirstlead1 = new OORTelesalesGetFirstLead(StdCtrl1 );
      OORtelFirstlead1.getFirstLead(); 
    }
}